<extend name="Common@Base/layout"/>
<block name="body">
    <div class="main-content main-pagebar-content">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-12">
                    <h3 class="mod-title">
                            <span class="t">
                               年终考核
                            </span>
                    </h3>
                    <div class="panel panel-default">
                        <form id="paging_form" name="paging_form" method="post" action="/examine/index/detail">
                            <input name="taskid" type="hidden" value="{$task.id}"/>
                            <div class="panel-body panel-body-up-table">
                                <div class="search-panel">
                                    <div class="search">
                                        <div class="dropdown btn-group">
                                            <a class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                                <span id="search_status_name" class="option-name">2018年</span> <i class="fa fa-angle-down"></i></a>
                                            <ul class="dropdown-menu dropdown-option-menu">
                                                <li><a data-value="2018" role="button">2018年</a></li>
                                            </ul>
                                            <input id="search_status" name="search_status" class="option-value filter-item-value" type="hidden"
                                                   value="{$_page->parameter['search_status']}">
                                        </div>
                                        <!--<div class="btn-group">-->
                                        <!--<input name="search_key" type="text" class="form-control" value="{$_page->parameter['search_key']|urldecode}"-->
                                        <!--placeholder="请输入标题">-->
                                        <!--</div>-->
                                        <div class="btn-group">
                                            <button type="submit">搜索</button>
                                        </div>
                                    </div>

                                </div>

                            </div>
                        </form>
                        <form id="assess_form" name="assess_form" method="post" action="/task/score/assess">
                            <input name="task_type" type="hidden" value="{$task.task_type}"/>
                            <div class="table-responsive">
                                <table class="table-check table-link-hover table table-striped table-bordered table-hover">
                                    <thead>
                                    <tr>
                                        <th>上报单位</th>

                                        <th class="text-center" style="width:16%">日常任务得分(占比 40%)</th>
                                        <th class="text-center" style="width:16%">年终测评得分(占比 40%)</th>
                                        <th class="text-center" style="width:16%">加分项得分(占比 20%)</th>
                                        <th class="text-center" style="width:6%">总分</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <volist name="user_list" id="user_row">
                                        <tr data-vid="{$user_row.user_id}">
                                            <td>{$user_row.user_id|fc_get_user_account}</td>
                                            <td class="text-center">
                                                {$user_row.task0|default=0}
                                            </td>
                                            <td class="text-center">
                                                {$user_row.task2|default=0}
                                            </td>
                                            <td class="text-center">
                                                {$user_row.task1|default=0}
                                            </td>
                                            <td class="text-center">
                                                {$user_row['task0']*40/100+$user_row['task2']*40/100+$user_row['task1']*20/100}
                                            </td>
                                        </tr>
                                    </volist>
                                    </tbody>
                                </table>
                                <input class="checked-item" type="hidden">
                            </div>
                        </form>
                    </div>

                </div>
            </div>
        </div>
    </div>


    <script>
        $(document).ready(function () {
            $('#nav-examine').addClass("active");
            var vx = $("#search_status").val();
            if (vx != "") {
                $("#search_status").prev().find('a').each(function () {
                    var $this = $(this);
                    if ($this.data('value') == vx) {
                        $("#search_status_name").text($this.text());
                    }
                });
            }

            $('button[data-percent]').click(function () {
                var $this = $(this);
                var input = $this.parent().next().find('input[placeholder]');
                var s = Math.round($this.parent().data('total_score') * $this.data('percent') / 100);
                input.val(s);
            });

            $('button[action-type="assess"]').click(function () {
                var $tr = $(this).parent().parent();
                alertify.confirm("确定操作？", function (e) {
                    $('#assess_form').submit();
                });
            });
        });
    </script>
</block>